package com.gw2.gw2world;

import com.gw2.gw2world.controller.NavigationManager;
import com.gw2.gw2world.controller.Tools;
import com.gw2.gw2world.fragment.SettingsFragment;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

/** Define user options:
 * <ul>
 * <li>Language</li>
 * <li>Region</li>
 * <li>Servers: home and 2 guesting servers</li>
 * </ul>
 * 
 * Future improvements:
 * <ul>
 * <li>Better UI (selecting region and servers)</li>
 * <li>Refresh rate configuration</li>
 * <li>Remove selected server from other lists</li>
 * </ul>
 */
public class SettingsActivity extends Activity /*implements OnPreferenceChangeListener*/ {
	@SuppressWarnings("unused")
	private static final String TAG="SettingsActivity";
	private NavigationManager nm;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Tools.forceLocale(this);
		setContentView(R.layout.settings);
		getFragmentManager().beginTransaction().replace(R.id.fl_settings, new SettingsFragment()).commit();
		nm=new NavigationManager(this, R.id.drawer_layout_settings, R.id.left_drawer_settings);
	}

	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //MenuInflater inflater = getMenuInflater();
        //inflater.inflate(R.menu.actionbar_actions, menu);
        return super.onCreateOptionsMenu(menu);
    }
	@Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        // If the nav drawer is open, hide action items related to the content view
        //boolean drawerOpen = nm.isDrawerOpen();
        //menu.findItem(R.id.action_websearch).setVisible(!drawerOpen);
        return super.onPrepareOptionsMenu(menu);
    }
	@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Pass the event to ActionBarDrawerToggle, if it returns
        // true, then it has handled the app icon touch event
        if (nm.getDrawerToggle().onOptionsItemSelected(item)) {
          return true;
        }
        // Handle your other action bar items...
        return super.onOptionsItemSelected(item);
	}

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // Pass any configuration change to the drawer toggles
        nm.getDrawerToggle().onConfigurationChanged(newConfig);
    }
	
}
